const puppeteer = require('puppeteer');

(async () => {
  try {
    const browser = await puppeteer.launch({ 
      headless: true,
      args: ['--no-sandbox', '--disable-setuid-sandbox']
    });
    const page = await browser.newPage();
    await page.goto('https://www.baidu.com', { 
      waitUntil: 'networkidle2', 
      timeout: 30000 
    });
    await page.screenshot({ 
      path: 'baidu-screenshot.png',
      fullPage: true,
      type: 'png'
    });
    await browser.close();
    console.log('百度截图已保存为 baidu-screenshot.png');
  } catch (error) {
    console.error('截图失败:', error);
    process.exit(1);
  }
})();
